/*******************************************************************************
 * WayStudio GUI Library
 * Developer:Xu Waycell
*******************************************************************************/
#ifndef WIDGET_HEADER
#define WIDGET_HEADER

#include <object.hpp>

BEGIN_HEADER

BEGIN_WS_NAMESPACE

class Layout;

struct GUIEvent;
struct RenderEvent;
struct ResizeEvent;
struct MoveEvent;
struct InputEvent;
struct CursorEvent;
struct KeyEvent;

class EXPORT Widget:public Object
{
	UNCOPYABLE(Widget)
	DECLARE_IMPLEMENTATION(Widget)
public:
	explicit Widget(Widget* PARENT=0);
	virtual ~Widget();

	Widget* Parent() const;

	boolean Visible() const;

	void Show();
	void Hide();

	uinteger MaximumHeight() const;
	uinteger MaximumWidth() const;

	void SetMaximumSize(uinteger, uinteger);

	uinteger MinimumHeight() const;
	uinteger MinimumWidth() const;

	void SetMinimumSize(uinteger, uinteger);

	String Title() const;
	void SetTitle(const String&);

	Layout* GetLayout() const;
	void SetLayout(Layout*);

	integer X() const;
	integer Y() const;

	uinteger Width() const;
	uinteger Height() const;

	void Move(integer, integer);
	void Resize(uinteger, uinteger);
protected:
	virtual void Render();
	
	virtual void ProcessEvent(Event*);
	virtual void ProcessGUIEvent(GUIEvent*);
	virtual void ProcessRenderEvent(RenderEvent*);
	virtual void ProcessResizeEvent(ResizeEvent*);
	virtual void ProcessMoveEvent(MoveEvent*);
	virtual void ProcessInputEvent(InputEvent*);
	virtual void ProcessCursorEvent(CursorEvent*);
	virtual void ProcessKeyEvent(KeyEvent*);
};

END_WS_NAMESPACE

END_HEADER

#endif
